package io.bdmc.core.msp2000;

import io.bdmc.modules.bss.entity.DeviceFibreMatch;
import io.bdmc.modules.bss.entity.DeviceRouteConfig;
import org.springframework.stereotype.Component;

import java.util.concurrent.ConcurrentLinkedQueue;

@Component
public class Msp2000DataCache {
    // OPM驱动告警队列
    private static final ConcurrentLinkedQueue<DeviceRouteConfig> opmMeasureQueue = new ConcurrentLinkedQueue<>();

    // OPM驱动告警队列
    private static final ConcurrentLinkedQueue<DeviceFibreMatch> fspMeasureQueue = new ConcurrentLinkedQueue<>();

    /**
     * 从trap队列插入一条数据
     *
     * @param data 需要入队的数据
     */
    public static void offerOpmMeasureQueue(DeviceRouteConfig data) {
        opmMeasureQueue.offer(data);
    }

    /**
     * 从队列取一条数据
     *
     * @return String
     */
    public static DeviceRouteConfig pollOpmMeasureQueue() {
        return opmMeasureQueue.poll();
    }

    /**
     * 判断队列是否为空
     * 
     * @return 是否为空
     */
    public static boolean isEmptyOpmMeasureQueue() {
        return opmMeasureQueue.isEmpty();
    }

    /**
     * 从trap队列插入一条数据
     *
     * @param data 需要入队的数据
     */
    public static void offerFspMeasureQueue(DeviceFibreMatch data) {
        fspMeasureQueue.offer(data);
    }

    /**
     * 从队列取一条数据
     *
     * @return String
     */
    public static DeviceFibreMatch pollFspMeasureQueue() {
        return fspMeasureQueue.poll();
    }

    /**
     * 判断队列是否为空
     * 
     * @return 是否为空
     */
    public static boolean isEmptyFspMeasureQueue() {
        return fspMeasureQueue.isEmpty();
    }
}
